package com.cnc.fd.sqlmapDao;

import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class MailConfigDaoImpl extends SqlMapClientDaoSupport implements IMailConfigDao{

    public void addMailConfigDefaut(String customer) {
        HashMap map=new HashMap();
        map.put("customer",customer);
        this.getSqlMapClientTemplate().insert("addMailConfigDefault", map);
    }

    public void deleteMailConfig(String customer) {
        this.getSqlMapClientTemplate().delete("deleteMailConfigConf",customer);
    }

    public HashMap getMailConfigByCustomer(String customer) {
        if(null==customer||""==customer)
            return null;
        return (HashMap)this.getSqlMapClientTemplate().queryForObject("getMailConfigByCustomer",customer);
    }

    public List getMailConfigByNameFuzzy(String customer) {
        String aux;
        if(null!=customer&&""!=customer)
        {
            aux="%"+customer+"%";
        }else{
            aux=customer;
        } 
        return this.getSqlMapClientTemplate().queryForList("getMailConfigByName",aux);
    }

    public Integer getTotalCount() {
        return (Integer)this.getSqlMapClientTemplate().queryForObject("getTotalCount");
    }

}
